package com.tbit.uqbike.client.constant.enums;

import com.tbit.uqbike.client.exception.BaseException;

/**
 * 礼品卡类型
 *
 * @author <a href="mailto:zheng.zebiao@tbit.com.cn">zb</a>
 * @since 2024/6/28
 */
public enum GiftCardType {
    /**
     * 礼品金
     */
    GIFT_CASH(0),
    /**
     * 优惠券
     */
    COUPON(1)
    ;
    public final int code;

    GiftCardType(int code) {
        this.code = code;
    }

    public static GiftCardType of(int code) {
        for (GiftCardType giftCardType : GiftCardType.values()) {
            if (giftCardType.code == code) {
                return giftCardType;
            }
        }
        throw new BaseException("礼品卡类型不存在");
    }
}
